package auth_center.controller;

import auth_center.feignapi.UserCenterApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author Ezio.Auditore
 */
@Controller
public class SuccessController {

    private static final String SUCCESS = "成功";

    /**
     * 用户模块feign客户端
     */
    @Autowired
    UserCenterApi userCenterApi;

    @GetMapping("/success")
    public String sucTest() {
        return "hello";
    }

    @GetMapping("/login")
    public String login(@RequestParam("username") String username, @RequestParam("password") String password) {
        String login = userCenterApi.login(username, password);
        if (login.contains(SUCCESS)) {
            return "登录成功";
        } else {
            return "登录失败";
        }
    }
}